<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >

<head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8" />

    <title>NetSpri</title>

    <link rel="stylesheet" type="text/css" href="/netspri/css/reset.css" media="screen" />

    <link rel="stylesheet" type="text/css" href="/netspri/css/text.css" media="screen" />

    <link rel="stylesheet" type="text/css" href="/netspri/css/grid.css" media="screen" />

    <link rel="stylesheet" type="text/css" href="/netspri/css/layout.css" media="screen" />

    <link rel="stylesheet" type="text/css" href="/netspri/css/nav.css" media="screen" />
	
	<script type="text/javascript" src="/netspri/js/jquery-2.2.3.js"></script>

<style type="text/css">


body{text-align: center;}

#mainp{padding-left: 120px;height: 538px;}

td {
	font-size: 20px;
}
th{
	font-size: 22px;
	font-weight: bold;
	color: navy;
	text-align: left;
	height: 34px;
}


#addbutton{

	
 	width: 150px;
    height: 50px;
  	
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0px -1px 0px #5b6ddc;
    outline: none;
    border: 1px solid rgba(0, 0, 0, .49);
 	
    -webkit-background-clip: padding-box;
    -moz-background-clip: padding-box;
    background-clip: padding-box;
    border-radius: 6px;
 
    background-color: #5466da;
    background-image: -webkit-linear-gradient(bottom, #5466da 0%, #768ee4 100%);
    background-image: -moz-linear-gradient(bottom, #5466da 0%, #768ee4 100%);
    background-image: -o-linear-gradient(bottom, #5466da 0%, #768ee4 100%);
    background-image: -ms-linear-gradient(bottom, #5466da 0%, #768ee4 100%);
    background-image: linear-gradient(bottom, #5466da 0%, #768ee4 100%);
     
    -webkit-box-shadow: inset 0px 1px 0px #9ab1ec;
    box-shadow: inset 0px 1px 0px #9ab1ec;
     
    cursor: pointer;
 
    -webkit-transition: all .1s ease-in-out;
    -moz-transition: all .1s ease-in-out;
    -o-transition: all .1s ease-in-out;
    -ms-transition: all .1s ease-in-out;
    transition: all .1s ease-in-out;
}


#pages a
{
    color: #000;
}
#pages a:hover
{
    background: #cddde4;
    border: #97b9c9 solid 1px;
    color: #067db5;
}
#pages a.current_page
{
    background: #FFF;
    border: #89bdd8 solid 1px;
    color: #067db5;
}

#pages
{
    width: 900px;
    text-align: center;
    height: 28px;
    line-height: 28px;
    margin-top: 5px;
}
#pages a, #pages a.current_page:hover
{
    padding: 5px 10px;
}
#pages a:hover
{
    padding: 5px 9px;
}




</style>


	<script type="text/javascript">
	

			
		 function deleteUser(id){
                var r = window.confirm("确定要删除此用户吗？");
                if(r){
                	$.ajax({
                		url:"/netspri/admin/"+id,
                		type:"delete",
                		success:function(data){
                			if(data){
                				
                				window.location="/netspri/admin/list/1";
                			}
                		}
                	});
              		
            	}
	                
              } 

	
	
	</script>



</head>


<body>
   
    <div class="container_12" style="padding-top: 20px;">

        <div class="grid_12 header-repeat">

            <div id="branding">

                <div class="floatleft">

                    <!-- <img src="img/logo.png" alt="Logo" /> -->
                    <h2 style="font-family: cursive;font-size: 50px;padding-left: 80px;color: white;">SPRi 管理员</h2></div>

                <div class="floatright">

                    <div class="floatleft">

                        <img src="/netspri/img/img-profile.jpg" alt="Profile Pic" /></div>

                    <div class="floatleft marginleft10">

                        <ul class="inline-ul floatleft">

                            <li style="font-size: 25px;">Hello Admin</li>

                            <li style="font-size: 25px;"><a href="#">${Admin }</a></li>

                            <li style="font-size: 25px;"><a href="/netspri/admin/logout">Logout</a></li>

                        </ul>

                    </div>

                </div>

              

            </div>

        </div>





      <div class="floatright" style="padding-right: 200px;">

        
<input type="button" id="addbutton"  value="添加用户" onclick="location='/netspri/admin/toadd'">
          </div>

        <div class="grid_10" id="mainp" >


		


            <div class="box round first grid">

                <h2 style="font-size: 25px;">

                    用户信息</h2>

                <div class="block">

                    

                    

                    

                    <table class="display" id="example" >

					<thead style="font-weight: bold;">

						<tr>

							<th>ID</th>

							<th>用户名</th>

							<th>性 别</th>

							<th>年 龄</th>

							<th>操 作</th>

						</tr>

					</thead>

					<tbody>
							<c:forEach items="${users }" var="user">

								<tr class="odd gradeX">

									<td>${user.user_id }</td>

									<td>${user.username }</td>

									<td><c:choose>
											<c:when test="${user.gender=='F'}">
												<a>女</a>
											</c:when>
											<c:otherwise>
												<a>男</a>
											</c:otherwise>
										</c:choose></td>

									<td>${user.age }</td>

									<td><input type="button" onclick="deleteUser(${user.user_id})" style="color: blue;" value="删除"></td>

								</tr>

							</c:forEach>





						</tbody>

				</table>
				

                    

                    

                </div>

            </div>


                    
				  <!--分页-->
                <div id="pages" style="margin-left: 120px;">
                
                
                <c:if test="${page.currentPage==1}">
					<a>首页</a>
				</c:if>
				<c:if test="${page.currentPage!=1}">
					<a href="1">首页</a>
				</c:if>
                
                
                		<!-- 当前页是首页则不能点上一页 -->
				<c:choose>
					<c:when test="${page.currentPage>1}">
						<a href="${page.currentPage-1}">上一页</a>
					</c:when>
					<c:otherwise>
						<a>上一页</a>
					</c:otherwise>
				</c:choose>

				<!-- 注意：页数不是按照集合循环！ -->
				<c:forEach begin="1" end="${page.totalPage}" var="i">
					<c:choose>
						<c:when test="${i==page.currentPage}">
							<a class="current_page">${i}</a>
						</c:when>
						<c:otherwise>
							<a href="/netspri/admin/list/${i}">${i}</a>
						</c:otherwise>
					</c:choose>
				</c:forEach>
				<!-- 当前页是最后一页，则不能点 -->
				<c:choose>
					<c:when test="${page.currentPage==page.totalPage}">
						<a>下一页</a>
					</c:when>
					<c:otherwise>
						<a href="${page.currentPage+1}">下一页</a>
					</c:otherwise>
				</c:choose>


				<c:if test="${page.currentPage!=page.totalPage}">
					<a href="${page.totalPage}">末页</a>
				</c:if>
				<c:if test="${page.currentPage==page.totalPage}">
					<a>末页</a>
				</c:if>

			</div>

			

		</div>

       

    </div>

   

    <div id="site_info">

        <p>

           <!--  Copyright <a href="#">jsls_spri</a>. All Rights Reserved. -->&nbsp;

        </p>

    </div>

  	


    <!--wrapper end-->

	<!--Dynamically creates analytics markup-->

	 
</body>

</html>
